GUI Help > Menus > addMenuItem

addMenuItem
addMenuItem handle menu, str caption, int returnValue, [int insertBefore], [str image]

Description:
Adds an item to a menu created with createMenu, createSubMenu or createPopupMenu. When the user selects the item from the menu, a MENU_CLICK message is sent to the window which owns the menu, and eventData() contains the menu item id (taken from the returnValue parameter ^ )

Return Value:


Parameters:
menu Handle to a menu
caption The text of the menu item
returnValue A number which identifies the new item. The number which will appear in eventData() when the menu item is selected. Use this to identify which menu item has been clicked. You also need to pass this number to the setMenuItemEnabled, setMenuItemChecked etc. commands to change the item.

You should use a different number for all menu items in your application, regardless of which menus they belong to.
[insertBefore] Optional. Usually items are added to the end of the menu, but sometimes you may want to insert a menu item into the menu in a different place. If specified, the new item will be inserted before this item.
[str image] Optional. A bitmap image usually 16x16 pixels in size which appears next to the menu item and takes the place normally reserved for check / radio marks. This must be a ".bmp" file.
Remarks:


See Also:


Example:
(Note: You will need to include the GUI constants file for this example to work)